
project(wd-app LANGUAGES CXX)

file (GLOB wu_headerFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.h)
file (GLOB wu_sourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.cpp)



find_package(OpenCV REQUIRED)


add_executable(${PROJECT_NAME} 
    ${CMAKE_CURRENT_SOURCE_DIR}/res/app.rc
    ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
    ${wu_headerFiles}
    ${wu_sourceFiles} )

target_include_directories(${PROJECT_NAME} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/res
    ${CMAKE_CURRENT_SOURCE_DIR}/src/ui
    ${CMAKE_CURRENT_SOURCE_DIR}/src/util
    ${CMAKE_CURRENT_SOURCE_DIR}/src/controls
    ${CMAKE_CURRENT_SOURCE_DIR}/../Duilib/
    ${CMAKE_CURRENT_SOURCE_DIR}/../Duilib/Core
    ${OpenCV_INCLUDE_DIRS} 
)


add_dependencies(${PROJECT_NAME} duilib wudong)


set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")

# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/)

target_link_libraries(${PROJECT_NAME} 
  duilib 
  wudong

)

# 添加资源编译器支持
if(CMAKE_SYSTEM_NAME MATCHES Windows)
    set(CMAKE_RC_COMPILER_INIT windres)
    enable_language(RC)
endif()

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_directory
    ${CMAKE_CURRENT_SOURCE_DIR}/skin
    ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/$<CONFIG>/skin
)

# install(
#   TARGETS ${PROJECT_NAME}
#   RUNTIME DESTINATION bin
#   LIBRARY DESTINATION lib
#   ARCHIVE DESTINATION lib
# )
